package com.cheap.search.es.pojo;

import cn.easyes.annotation.IndexField;
import cn.easyes.annotation.IndexId;
import cn.easyes.annotation.IndexName;
import cn.easyes.common.enums.IdType;
import com.cheap.common.pojo.po.Item;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

@Data
@EqualsAndHashCode
@IndexName(value = "item", shardsNum = 1, replicasNum = 0)
public class ItemDoc implements Serializable {

    public ItemDoc(Item hotel) {
        this.id = hotel.getId();
        this.name = hotel.getName();
        this.price = hotel.getPrice();
        this.stock = hotel.getStock();
        this.image = hotel.getImage();
        this.category = hotel.getCategory();
        this.brand = hotel.getBrand();
        this.spec = hotel.getSpec();
        this.sold = hotel.getSold();
        this.commentCount = hotel.getCommentCount();
    }

    @IndexId(type = IdType.CUSTOMIZE)
    private Long id;//商品id
    @IndexField(analyzer = "standard")
    private String name;//商品名称
    private Long price;//价格（分）
    private Integer stock;//库存数量
    private String image;//商品图片
    @IndexField(analyzer = "standard")
    private String category;//分类名称
    @IndexField(analyzer = "standard")
    private String brand;//品牌名称
    private String spec;//规格
    private Integer sold;//销量
    private Integer commentCount;//评论数


}